package Lesson15;

public class Car 
{
	double price;
	boolean isSportCar;
	String model;
	String color;
	double maxSpeed;
	Person owner;
	
	Car(String model, boolean isSportCar, String color)
	{
		this.model = model;
		this.isSportCar = isSportCar;
		this.color = color;
	}
	
	Car(String model, boolean isSportCar, String color, double price, double maxSpeed, String owner)
	{
		this(model, isSportCar, color);
		this.price = price;
		if (maxSpeed > 200)
		{
			if (isSportCar == true)
				this.maxSpeed = maxSpeed;
		}
		else
			this.maxSpeed = maxSpeed;
	}
	
	boolean isMoreExpensive (Car car)
	{
		if (car.price > this.price)
			return false;
		else
			return true;
	}
	
	double calculateCarPriceForScrap (double metalPrice)
	{
		double coef = 0.2;
		if (this.color.equalsIgnoreCase("black") || this.color.equalsIgnoreCase("white"))
			coef+=0.05;
		if (this.isSportCar)
			coef+=0.05;
		
		return metalPrice*coef;
	}
	void changeOwner (Person person)
	{
		this.owner = person;
	}
	
}
